package br.com.android.financas;

import org.joda.time.DateTime;

public class MesTotal implements Comparable<MesTotal>{
		private DateTime mes;
		private double total;

		public DateTime getMes() {
			return mes;
		}
		public void setMes(DateTime mes) {
			this.mes = mes;
		}
		public double getTotal() {
			return total;
		}
		public void setTotal(double total) {
			this.total = total;
		}

		public void adicionarAoTotal(double total){
			this.total+=total;
		}
		public void subtrairAoTotal(double total){
			this.total-=total;
		}
		@Override
		public int compareTo(MesTotal another) {
			if(this.getMes().isAfter(another.getMes()))
				return 1;
			if(this.getMes().isBefore(another.getMes()))
				return -1;

			return 0;
		}
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
			result = prime * result + ((mes == null) ? 0 : mes.hashCode());
			return result;
		}
		@Override
		public boolean equals(Object obj) {
			if (this == obj)
				return true;
			if (obj == null)
				return false;
			if (getClass() != obj.getClass())
				return false;
			MesTotal other = (MesTotal) obj;
			if (mes == null) {
				if (other.getMes() != null)
					return false;
			} else if (!mes.equals(other.getMes()))
				return false;
			return true;
		}


	}